]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
padOsd: Cache label coordinates/arrangements
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 29 May 2020 14:07:28 +0000 (16:07 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Fri, 29 May 2020 18:06:48 +0000 (18:06 +0000)
This is actually static for a given PadDiagram, as it always represents
a single device.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2570
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1290

js/ui/padOsd.js

index 3e7b7beac086cd3e2eee62a1bbfabcbfa234fecd..8aadf5114a04eff0f4179c634fdab302d373f81b 100644 (file)
@@ -444,14 +444,12 @@ var PadDiagram = GObject.registerClass({
         this._updateDiagramScale();
 
         for (let i = 0; i < this._labels.length; i++) {
-            const { label, action, idx, dir } = this._labels[i];
-            let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
+            const { label, x, y, arrangement } = this._labels[i];
             this._allocateChild(label, x, y, arrangement);
         }
 
         if (this._editorActor && this._curEdited) {
-            const { action, idx, dir } = this._curEdited;
-            let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
+            const { x, y, arrangement } = this._curEdited;
             this._allocateChild(this._editorActor, x, y, arrangement);
         }
     }
@@ -576,12 +574,12 @@ var PadDiagram = GObject.registerClass({
     }
 
     _addLabel(action, idx, dir) {
-        let [found] = this._getLabelCoords(action, idx, dir);
+        let [found, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
         if (!found)
             return false;
 
         let label = new St.Label();
-        this._labels.push({ label, action, idx, dir });
+        this._labels.push({ label, action, idx, dir, x, y, arrangement });
         this.add_actor(label);
         return true;
     }